package com.ititer.mail;

import java.io.IOException;
import java.util.Properties;

public class MailTemplate {
	/**
	 * The templates type.
	 * @author aceyin
	 *
	 */
	public enum TemplateType {
		Register
	};

	private static final String CONTENT = ".content";
	private static final String SUBJECT = ".subject";

	private Properties templates;

	private String templateFile;

	public void init() {
		try {
			templates = new Properties();
			templates.load(MailTemplate.class.getResourceAsStream(templateFile));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public String getSubject(TemplateType type) {
		return templates.getProperty(type.name() + SUBJECT);
	}

	public String getBody(TemplateType type) {
		return templates.getProperty(type.name() + CONTENT);
	}

	public void setTemplateFile(String templateFile) {
		this.templateFile = templateFile;
	}
}
